﻿@{
    ViewBag.Title = "保单详情";
    var id = Model != null ? Model.ID : 0;
    var statusDesc = Model.Status >= (byte)InsuranceWarrantyStatus.Close ? "已处理的任务" : "跟进中的任务";
}
@using ZBJF.Warranty.Common.Enums.InsuranceWarranty
@using ZBJF.Warranty.WebProvider
@using EnumHelper = ZBJF.Warranty.Common.Common.EnumHelper
@model ZBJF.Warranty.Model.InsuranceWarrantyRecord
@using ZBJF.Warranty.BLL;
@Scripts.Render("~/bundles/StarRaty")
@Styles.Render("~/Content/StarRaty")
<ul id="myTab" class="nav nav-tabs">
    <li class="active"><a href="#editInfo" data-toggle="tab">@statusDesc</a></li>
</ul>
<div id="myTabContent" class="tab-content">
    <div class="tab-pane  fade in active" id="editInfo">
        <h4>常用功能</h4>
        <div class="border-gray">
            <a class="btn margin-10" href="javascript:void(0)" onclick="showInsuranceOrderInfoLayer()">保单信息</a>
            @if (ViewBag.ParentStatus == (byte)InsuranceWarrantyStatus.Processed)
            {
                <a class="btn margin-10" href="javascript:void(0)" onclick="showIWRDataCollectLayer()">附件资料 </a>
                <a class="btn margin-10" href="javascript:void(0)" onclick="showSendBackInfoLayer()">寄件信息</a>
            }
            <a class="btn btn-info margin-10" href="javascript:void(0)">工单状态：@ServiceFactory.InsuranceWarrantyRecordStatusServiceInstance.GetStatusName(Model.Status)</a>
        </div>

        <h4>报案信息</h4>
        <table class="table table-responsive table-bordered table-hover">
            <tr>
                <th class="w200">报案人：</th>
                <td>@Model.Reporter</td>
                <th class="w200">报案人手机：</th>
                <td>@Model.ReporterPhone</td>
            </tr>
            <tr>
                <th>报案日期：</th>
                <td>@Model.CreateTime</td>
                <th>出险日期：</th>
                <td>@Model.ExpectAccidentDate</td>
            </tr>
        </table>
        <h4>出险信息</h4>
        <table class="table table-responsive table-bordered table-hover">
            <tr>
                <th class="w200">被保险人（出险人）：</th>
                <td>@Model.InsuranceOrder.UserName</td>
                <th class="w200">被保险人电话：</th>
                <td>@Model.InsuranceOrder.UserPhone</td>
                <th class="w200">证件号码：</th>
                <td>@Model.InsuranceOrder.CertificateNO</td>
            </tr>
            <tr>
                <th class="w200">出险地点：</th>
                <td>@(Model.D_Province != null ? Model.D_Province.ProvinceName : string.Empty) @(Model.D_City != null ? Model.D_City.CityName : string.Empty)</td>
                <th>出险地点（详细地址）：</th>
                <td colspan="3">
                    @Model.AccidentAddress
                </td>
            </tr>
        </table>
        <h4>被保险设备信息</h4>
        <table class="table table-responsive table-bordered table-hover">
            <tr>
                <th class="w200">品牌：</th>
                <td>@Model.InsuranceOrder.ProductBrandName</td>
                <th class="w200">型号：</th>
                <td>@Model.InsuranceOrder.ProductModelName</td>
                <th class="w200">设备识别码：</th>
                <td>@(string.IsNullOrEmpty(Model.InsuranceOrder.IMEI) ? Model.InsuranceOrder.IDFV : Model.InsuranceOrder.IMEI)</td>
            </tr>
        </table>

        @if (ViewBag.ParentStatus == (byte)InsuranceWarrantyStatus.Processed)
        {

            <h4>案件处理信息</h4>
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th width="100px">序号</th>
                        <th>损失名称</th>
                        <th>损失数量</th>
                        <th>保险结算价</th>
                    </tr>
                </thead>
                <tbody>
                    @* ReSharper disable once InconsistentNaming *@
                    @for (int i = 0; i < Model.InsuranceWarrantyRecordItem.Count; i++)
                    {
                        var InsuranceWarrantyRecordItem = Model.InsuranceWarrantyRecordItem.ToList();
                        <tr class="text-center" id="trInsuranceWarrantyRecordItem_@(i)">
                            <td>
                                @(i + 1)
                            </td>
                            <td>
                                @Html.HiddenFor(m => InsuranceWarrantyRecordItem[i].ID)
                                @Html.HiddenFor(m => InsuranceWarrantyRecordItem[i].InsuranceWarrantyRecordId)
                                @Html.DisplayFor(m => InsuranceWarrantyRecordItem[i].LostName)
                            </td>
                            <td>
                                @Html.DisplayFor(m => InsuranceWarrantyRecordItem[i].LostCount)
                            </td>
                            <td>
                                @Html.DisplayFor(m => InsuranceWarrantyRecordItem[i].LostNuclearPrice)
                            </td>
                        </tr>
                    }
                </tbody>
            </table>

        }

    </div>
</div>
@section scripts{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
    @Scripts.Render("~/bundles/chosen")
    <script type="text/javascript">
    $(function () {
        $("#WarrantyServiceScore").raty({
            score: $("#Grade").val(),
            scoreName: "WarrantyServiceScore"
        });

        $("#star").raty({
            readOnly: true,
            score: $("#WarrantyServiceScore").val()
        });

        $('#tbInsuranceWarrantyRecordItem').dataTable({
            "bServerSide": false,
            "bProcessing": false,
            "allowHeaderDoubleClick": true,
            "bSort": false,
            "sDom": "R", //可拖拽
            "oColReorder": {
                "bAddFixed": false
            }
        });
        $('#tbInsuranceWarrantyRecordFree').dataTable({
            "bServerSide": false,
            "bProcessing": false,
            "allowHeaderDoubleClick": true,
            "bSort": false,
            "sDom": "R", //可拖拽
            "oColReorder": {
                "bAddFixed": false
            }
        });
    });

    function showInsuranceOrderInfoLayer() {
        layer.open({
            type: 2,
            title: '保单信息',
            shadeClose: true,
            shade: 0.8,
            area: ['80%', '600px'],
            content: '/InsuranceWarrantyRecordDetail/InsuranceOrderInfo?insuranceOrderId=@Model.InsuranceOrder.ID' //iframe的url
        });
    }
    function showIWRDataCollectLayer() {
        layer.open({
            type: 2,
            title: '附件信息',
            shadeClose: true,
            shade: 0.8,
            area: ['820px', '75%'],
            content: '/InsuranceWarrantyRecordDetail/IWRDataCollect?insuranceWarrantyRecordId= @Model.ID'  //iframe的url
        });
    }
    function showSendBackInfoLayer() {
        layer.open({
            type: 2,
            title: '寄件信息',
            shadeClose: true,
            shade: 0.8,
            area: ['820px', '520px'],
            content: '/InsuranceWarrantyRecordDetail/SendBackInfo/@Model.ID' //iframe的url
        });
    }
</script>
}
